Memo formulae, If Statement, Format

Hi All,

I am new to Fastreports and am really struggling on a few issues. I am using Delphi 6 Professional. I am trying to do the following:


1. Format showing negative numbers in brackets. also format as a percentage?

2. formula in memo - if datafield2 = 0 then 0 otherwise (datafield1-datafield2)/datafield2

and

3. if datafield1 = "XYZ" then SUM(DATAFIELD3)

I just cannot see what I am doing wrong with my expressions in FastReports

Any help will be most appreciated.

Kind regards

Wayne




Comments

  • edited 4:31AM
    WayneBr wrote: »
    1. Format showing negative numbers in brackets. also format as a percentage?
    2. formula in memo - datafield2 = 0 then 0 otherwise (datafield1-datafield2)/datafield2
    and
    3. if datafield1 = "XYZ" then SUM(DATAFIELD3)
    Ad.1.
    Click context menu for your memo and choose formating
    Ad.2.
    Should be IIF( datafield2 = 0, 0, (datafield1-datafield2)/datafield2)
    Ad.3.
    This is more complicated. You should write your own on before event for summary band.
    Something like:
    var gValue4memo :real;
    
    procedure Footer1OnBeforePrint( Sender: TfrxComponent);
    var LSum: real;
    begin
       LSum := SUM( <myQuery."DATAFIELD3">);
       if datafield1 = "XYZ" 
           then gValue4Memo := LSum
           else gValue4Memo := <whatever you wish>
    end
    
    and your Memo should look like [gValue4Memo].
    Read the documentation - some of your questions may be answered there >

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.